package com.lyncs.ods.req;

import com.fasterxml.jackson.databind.PropertyNamingStrategy;
import com.fasterxml.jackson.databind.annotation.JsonNaming;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;

import javax.validation.constraints.NotNull;
import java.math.BigDecimal;
import java.time.LocalDate;
import java.util.List;

/**
 * @author alex
 * @date 2022/2/5 20:43
 * @description
 */
@EqualsAndHashCode(callSuper = true)
@Data
@JsonNaming(PropertyNamingStrategy.SnakeCaseStrategy.class)
public class SaveOrderReq extends SaveTxnBaseReq {

    @ApiModelProperty(value = "订单日期")
    private LocalDate startDate;

    @ApiModelProperty(value = "订单名称")
    private String orderName;

    @ApiModelProperty(value = "预计交付时间")
    private LocalDate estimatedDeliveryTime;

    @ApiModelProperty(value = "订单id")
    private Long orderId;

    @ApiModelProperty(value = "备注")
    private String remark;

    @ApiModelProperty(value = "货币")
    @NotNull
    private String currency;

    @ApiModelProperty("目的地港/机场")
    private String destinationPort;

    @ApiModelProperty("包装")
    private String packing;

    @ApiModelProperty("唛头")
    private String shippingMarks;

    @ApiModelProperty("贸易规则")
    private String tradingTerms;

    @ApiModelProperty("支付方式")
    private String paymentTerms;

    @ApiModelProperty("运输方式")
    private String shipment;

    @ApiModelProperty("装运港/机场")
    private String loadingPort;

    @ApiModelProperty("转运港/机场")
    private String transshipmentPort;

    @ApiModelProperty("自定义字段信息")
    private String customFields;

    @ApiModelProperty("附件")
    private String attachment;

    @ApiModelProperty(value = "sku info")
    @NotNull
    private List<OrderSkuInfo> skuInfoList;

    @Data
    @JsonNaming(PropertyNamingStrategy.SnakeCaseStrategy.class)
    public static class OrderSkuInfo {
        @ApiModelProperty(value = "sku id")
        @NotNull
        private Long skuId;

        @ApiModelProperty(value = "总商品数")
        @NotNull
        private BigDecimal count;

        @ApiModelProperty(value = "SKU 单价")
        @NotNull
        private BigDecimal amount;

        @ApiModelProperty(value = "备注")
        private String remark;
    }
}
